<?php
/**
 *@author Connor <caokang@foxmail.com>
 *@todo
 *@link www.zeevin.com
 */
?>
<div class="title">
	<h3>修改密码</h3>
	<ul>
		<li><a href="?r=setting/base" title="基本资料">基本资料</a></li>
		<li class="current"><a href="?r=setting/password" title="修改密码">修改密码</a></li>
	</ul>
</div>
<div class="main_content">
	<?php echo CHtml::beginForm('?r=setting/password','post',array('id'=>'repwd'));?>
	<div class="set_mail">
		<div class="set_list">
			<?php echo CHtml::label('当前密码：', 'old_pass');?><?php echo CHtml::textField('old_pass','',array('class'=>'validate','validator'=>'required'));?>
		</div>
		<div class="set_list">
			<?php echo CHtml::label('新密码：', 'new_pass');?><?php echo CHtml::passwordField('new_pass','',array('class'=>'validate','validator'=>'required'));?>
		</div>
		<div class="set_list">
			<?php echo CHtml::label('确认新密码：', 're_pass');?><?php echo CHtml::passwordField('re_pass','',array('class'=>'validate','validator'=>'required'));?>
		</div>
		<div class="set_but">
			<?php echo CHtml::submitButton('修改',array('class'=>'validate_check'));?>
		</div>
	</div>
	<?php echo CHtml::endForm();?>
</div>
<script type="text/javascript">
$(document).ready(function(){

var options = {
beforeSubmit:function(){
	if($('#re_pass').val() !='' && $('#re_pass').val()!=$('#new_pass').val()){
			$('#re_pass').next('.warning').remove();
			$('#re_pass').after("<p  class='warning false'>× </p>");
			$('#re_pass').next('.warning').append('两次密码输入不一致');
			validator_status +=1;
	}
	if(validator_status){return false;}
},
     success: function(data) { 
            var msg='密码修改失败';
            switch(data){
                case '0': msg="密码修改成功";break;
                case '1': msg="两次密码输入不一致";break;
                case '2': msg='密码错误，请重新输入';break;
                case '3': msg="密码修改失败请检查后重新操作";break;
            }

            $('#topmsg').html(msg)
            $('#showmsg').show();
            showDialog();
            setTimeout(function(){$('#showmsg').hide();},1000);
        }
};
$('#repwd').ajaxForm(options);
})
</script>